/*
 * 项目名称:    wms-server-jeecg
 * 创建人员:    hansen
 * 创建时间:    2023-09-14
 */
package org.jeecg.modules.dock.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.dock.entity.dto.request.*;
import org.jeecg.modules.dock.entity.dto.response.*;
import org.jeecg.modules.dock.service.SapDockingRepeaterService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * SAP数据对接记录
 *
 * @author hansen
 * @version 1.0.0
 * @date 2023-09-14 14:50:59
 */
@Slf4j
@RestController
@RequestMapping("dock/repeater")
@RequiredArgsConstructor
@Api(tags = "SAP业务调用模块")
public class SapDockingRepeaterController {

    private final SapDockingRepeaterService sapDockingRepeaterService;

    /**
     * 销售出库过账
     *
     * @param list 数据
     * @return java.util.List<org.jeecg.modules.dock.entity.dto.response.SellOutboundResponseDTO>
     * @author hansen
     * @since 2023/9/14 15:32
     */
    @ApiOperation(value = "销售出库过账", notes = "销售出库过账")
    @PostMapping("/sapSellOutbound")
    public List<SellOutboundResponseDTO> sapSellOutbound(@RequestBody List<SellOutboundRequestDTO> list) {
        return sapDockingRepeaterService.repeaterSapSellOutbound(list);
    }

    /**
     * 成品UB单收货
     *
     * @param list
     * @return java.util.List<org.jeecg.modules.dock.entity.dto.response.ProductReceptionResponseDTO>
     * @author hansen
     * @since 2023/9/15 8:28
     */
    @ApiOperation(value = "成品UB单收货", notes = "成品UB单收货")
    @PostMapping("/sapProductHarvest")
    public List<ProductReceptionResponseDTO> sapProductHarvest(@RequestBody List<ProductReceptionRequestDTO> list) {
        return sapDockingRepeaterService.repeaterSapProductHarvest(list);
    }

    /**
     * 研发领料
     *
     * @param list
     * @return java.util.List<org.jeecg.modules.dock.entity.dto.response.SapBaseResponseDTO>
     * @author hansen
     * @since 2023/9/15 9:03
     */
    @ApiOperation(value = "研发领料", notes = "研发领料")
    @PostMapping("/sapResearchGet")
    public List<SapBaseResponseDTO> sapResearchGet(@RequestBody List<ResearchGetRequestDTO> list) {
        return sapDockingRepeaterService.repeaterSapResearchGet(list);
    }

    /**
     * 结构件/夹件UB单收货
     *
     * @param list
     * @return java.util.List<org.jeecg.modules.dock.entity.dto.response.ProductReceptionResponseDTO>
     * @author hansen
     * @since 2023/9/15 9:13
     */
    @ApiOperation(value = "结构件/夹件UB单收货", notes = "结构件/夹件UB单收货")
    @PostMapping("/constructionReceiving")
    public List<ProductReceptionResponseDTO> constructionReceiving(@RequestBody List<ProductReceptionRequestDTO> list) {
        return sapDockingRepeaterService.constructionReceiving(list);
    }

    /**
     * 辅料成本中心领用
     *
     * @param list
     * @return java.util.List<org.jeecg.modules.dock.entity.dto.response.IngredientsGetResponseDTO>
     * @author hansen
     * @since 2023/9/15 9:18
     */
    @ApiOperation(value = "辅料成本中心领用", notes = "辅料成本中心领用")
    @PostMapping("/sapIngredientsGet")
    public List<IngredientsGetResponseDTO> sapIngredientsGet(@RequestBody List<IngredientsGetRequestDTO> list) {
        return sapDockingRepeaterService.sapIngredientsGet(list);
    }

    /**
     * 同步sap主数据
     *
     * @param masterDataRequestDTO
     * @return
     */
    @ApiOperation(value = "同步sap主数据", notes = "同步sap主数据")
    @PostMapping("/sapMaster")
    public MasterDataResponseDTO sapMaster(@RequestBody MasterDataRequestDTO masterDataRequestDTO) {
        return sapDockingRepeaterService.sapMaster(masterDataRequestDTO);
    }

    /**
     * 钢卷批次特性调用
     *
     * @param type
     * @return
     */
    @ApiOperation(value = "钢卷批次特性调用", notes = "钢卷批次特性调用")
    @GetMapping("/getSapSteelCoilInfo")
    public List<SapSteelCoilResponseDTO> getSapSteelCoilInfo(@RequestParam("type") String type, @RequestParam("code") String code) {
        return sapDockingRepeaterService.getSapSteelCoilInfo(type, code);
    }

    /**
     * 原卷UB单收货
     *
     * @param list
     * @return
     */
    @ApiOperation(value = "原卷UB单收货", notes = "原卷UB单收货")
    @PostMapping("/getOriginalVolumeUbOrderTakeOver")
    public List<OriginalVolumeUbOrderTakeOverResponseDTO> getOriginalVolumeUbOrderTakeOver(@RequestBody List<OriginalVolumeUbOrderTakeOverRequestDTO> list) {
        return sapDockingRepeaterService.getOriginalVolumeUbOrderTakeOver(list);
    }

    /**
     * 外购收货接口（辅材）
     *
     * @param list
     * @return
     */
    @ApiOperation(value = "外购收货接口（辅材）", notes = "外购收货接口（辅材）")
    @PostMapping("/getPurchaseReceiptAssist")
    public List<PurchaseReceiptAssistResponseDTO> getPurchaseReceiptAssist(@RequestBody List<PurchaseReceiptAssistRequestDTO> list) {
        return sapDockingRepeaterService.getPurchaseReceiptAssist(list);
    }

    /**
     * 外购收货接口（原卷/成品）
     *
     * @param list
     * @return
     */
    @ApiOperation(value = "外购收货接口（原卷/成品）", notes = "外购收货接口（原卷/成品）")
    @PostMapping("/getPurchaseReceiptFinishProduct")
    public List<PurchaseReceiptFinishProductResponseDTO> getPurchaseReceiptFinishProduct(@RequestBody List<PurchaseReceiptFinishProductRequestDTO> list) {
        return sapDockingRepeaterService.getPurchaseReceiptFinishProduct(list);
    }

    @ApiOperation(value = "物料批次特性查询", notes = "物料批次特性查询")
    @PostMapping("/material-batch-peculiarity")
    public List<MaterialBatchPeculiarityResponseDTO> materialPeculiarity(@RequestBody List<MaterialBatchPeculiarityDTO> list) {
        return sapDockingRepeaterService.materialPeculiarity(list);
    }

    @ApiOperation(value = "条料调拨订单发送接口", notes = "条料调拨订单发送接口")
    @PostMapping("/sendingOfMaterialTransferOrders")
    public SapBaseResponseDTO sendingOfMaterialTransferOrders(@RequestBody List<MaterialTransferOrderRequestDTO> list) {
        return sapDockingRepeaterService.sendingOfMaterialTransferOrders(list);
    }

    @ApiOperation(value = "库存盘点调整接口", notes = "库存盘点调整接口")
    @PostMapping("/inventoryCountAdjustment")
    public List<InventoryUpdateResponseDTO> inventoryCountAdjustment(@RequestBody List<InventoryAdjustRequestDTO> list) {
        return sapDockingRepeaterService.inventoryCountAdjustment(list);
    }

    @ApiOperation(value = "库存更新接口", notes = "库存更新接口")
    @PostMapping("/inventoryUpdate")
    public List<InventoryUpdateResponseDTO> inventoryUpdate(@RequestBody List<InventoryUpdateRequestDTO> list) {
        return sapDockingRepeaterService.inventoryUpdate(list);
    }

    @ApiOperation(value = "销售出库单打印查询接口", notes = "销售出库单打印查询接口")
    @PostMapping("/saleOutboundPrintInfo")
    public SearchPrintInfoHeadResponseDTO saleOutboundPrintInfo(@RequestBody SearchPrintInfoRequestDTO searchPrintInfoRequestDTO) {
        return sapDockingRepeaterService.saleOutboundPrintInfo(searchPrintInfoRequestDTO);
    }

    /**
     * 测试接口
     *
     * @return
     */
    @ApiOperation(value = "测试接口", notes = "测试接口")
    @PostMapping("/testSap")
    public Object testSap(@RequestBody Object data, @RequestHeader("code") String code) {
        return sapDockingRepeaterService.testSap(data, code);
    }

    /**
     * 批次库存查询接口
     *
     * @param dto 查询条件
     * @return Result
     * @author DongPeng
     * @date 2024/1/4 9:07
     */
    @ApiOperation(value = "批次库存查询接口", notes = "批次库存查询接口")
    @PostMapping("/batchStockQuery")
    public Result batchStockQuery(@RequestBody List<BatchStockQueryRequestDTO> dto) {
        return sapDockingRepeaterService.batchStockQuery(dto);
    }

}
